package edu.wschina.module_c_hanoitower;

import org.json.JSONObject;

public class RankItem {
    public String id;
    public String nickname;
    public int duration;
    public int moves;
    public int difference;
    public String level;
    public String date;

    public RankItem(String id, String nickname, int moves,  int difference,int duration,String level, String date) {
        this.id = id;
        this.nickname=nickname;
        this.moves = moves;
        this.difference=difference;
        this.duration = duration;
        this.level = level;
        this.date = date;
    }

    public JSONObject toJson() {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("id", this.id);
            jsonObject.put("nickname", this.nickname);
            jsonObject.put("moves", this.moves);
            jsonObject.put("difference", this.difference);
            jsonObject.put("duration", this.duration);
            jsonObject.put("level", this.level);
            jsonObject.put("date", this.date);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonObject;
    }
}